﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using KPIS.GERP.GHRMS.BLL;
using KPIS.GERP.GHRMS.IBLL;
using KPIS.GERP.GHRMS.MODEL;
using KPIS.GERP.GHRMS.DAL;
using Telerik.Web.UI;

namespace KPIS.GERP.GHRMS.APP.App_UI.Forms
{
    public partial class TR_TrainingCoursesDescr : System.Web.UI.Page
    {
        HR_Development iniData = new HR_Development();
        ComboBLL combo = new ComboBLL();
        ITrainingScholarshipTypeBLL SchTypeBLL = new TrainingScholarshipTypeBLL();
        InitialData_BLL iniDataCur = new InitialData_BLL();
        ITrainingScholarshipFundBLL SchFundBLL = new TrainingScholarshipFundBLL();
        ITrainingInstituteBLL InstituteBLL = new TrainingInstituteBLL();
        ConvertNullable cn = new ConvertNullable();
        TrainingCoursesInfo courseInfo = new TrainingCoursesInfo();
        TrainingCoursesDAL courseDAL = new TrainingCoursesDAL();

        
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                
                LoadDataGrid();
                bindCommandType();
            }
            
        }
        
        private void LoadDataGrid()
        {

            DataSet ListDataCommand = courseDAL.GetData();
            DataTable table = ListDataCommand.Tables[0];
            //tblTRCoursDesList.DataSource = ListSalaryCommand.Tables[0];
            //RadGrid2.DataSource = courseDAL.GetFull();
            RadGrid2.DataSource = ListDataCommand.Tables[0];
            RadGrid2.DataBind();
            
        }

        protected void RadGrid2_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            //if (e.CommandName == "Delete")
            //{
            //    int seq = Convert.ToInt32((e.Item as GridDataItem).OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Sequence"]);
            //    iniData.DeleteTrainingCoursesDescr(seq);
            //}
            //if (e.CommandName == "ExpandCollapse")
            //    return;
            //LoadDataGrid();
        }

        protected void RadGrid2_ItemDataBound(object sender, GridItemEventArgs e)
        {
        //    if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
        //    {
        //        string scr;
        //        if (e.Item.Cells[6].Text == "1")
        //            scr = "<img src='../Images/Buttons/Update.gif'>";
        //        else
        //            scr = "<img src='../Images/Buttons/Cancel.gif'>";
        //        e.Item.Cells[6].Text = scr;

        //    }
        }
        private void bindCommandType()
        {
            //DataTable InfoList = combo.ListTrainingCourse();

            //ddlType.DataSource = InfoList;
            //ddlType.DataBind();
        }

        protected void ddlType_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
        {

        }
        protected void cmdAddTrainee_Click(object sender, EventArgs e)
        {
            Response.Redirect("TR_TrainingCoursesAddTrainee.aspx");
        }

    }
}
